<template>
  <div class="login">
    <back />
    <div class="container">
      <div class="container-logo">
        <Nav></Nav>
      </div>
      <div class="container-core">
        <div class="left">
          <Left />
        </div>
        <div class="rigth">
          <Rigth />
        </div>
      </div>
    </div>
  </div>
</template>
<script setup>
import Nav from "./components/Nav.vue";
import Left from "./components/Left.vue";
import Rigth from "./components/Right.vue";
import back from "@/components/background/index.vue";
import { useUserStore } from "@/store/useUserStore.js";
import { storeToRefs } from "pinia";
import { watchEffect } from "vue";
import { gsap } from "gsap";
const store = useUserStore();
const { isLogin } = storeToRefs(store);
import {useRouter} from "vue-router"
const router = useRouter()
watchEffect(() => {
  if (isLogin.value) {
    gsap.to(".left", {
      x: -1100,
    });
    gsap.to(".rigth", {
      x: 1100,
    });
    gsap.to(".container-logo",{
      y:-500
    })
    router.push({
      name:"home"
    })
  }
});
</script>

<style scoped lang="less">
@import "@/styles/mixin.less";

.login {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}
.cavas-container {
  width: 100%;
  height: 100%;
}
.container {
  .self-fill();
  .container-logo {
    margin: 10px 0 0 10px;
  }
  .container-core {
    height: 100%;
    display: flex;
    position: relative;
    .left {
      width: 100%;
    }
    .rigth {
      width: 100%;
    }
  }
}
</style>